<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.ejoysoft.etable.business.Article,
				 com.ejoysoft.common.Constants,
				 com.ejoysoft.util.ParamUtil,
				 java.io.File"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
	Article obj=new Article(globa,true);
    String strUrl="article_list.jsp";
    if(action.equals(Constants.DELETE_STR)){
    	String[] aryStrId = ParamUtil.getStrArray(request, "strId");
    	for (int i = 0; i < aryStrId.length; i++) {
    		Article obj0 = obj.show("where strId ='"+aryStrId[i]+"'");
    		String year = obj0.getDtCreateTime();
    		year = year.substring(0, year.indexOf("-"));
    		File f = new File(getServletContext().getRealPath("/")+"/"+globa.getPropValue("PATH_WEB_FILE")+"/"+year+"/Article/"+aryStrId[i]+"/");
    		if (f.exists()) {
    			File[] aryFile = f.listFiles();
    			for (int j = 0; aryFile != null && j < aryFile.length; j++) {
    				aryFile[j].delete();
    			}
    			f.delete();
    		}
	    	obj.delete("where strId ='"+aryStrId[i]+"'");
    	}
    	globa.dispatch(true, strUrl);
	} else {
	    if(action.equals(Constants.ADD_STR)) {
		    globa.dispatch(obj.add(), strUrl);
		}else if(action.equals(Constants.UPDATE_STR)){
		    globa.dispatch(obj.update(obj.getStrId()),strUrl);
		}
	}
    //关闭数据库连接对象
    globa.closeCon();
%>